<template>
	<view class="video">
		<video id="myVideo" :src="videoUrl" class="myVideo"></video>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				videoUrl:'',
				id:"",
				title:'',
				permission:'',
				duration:''
			}
		},
		onReady: function (res) {
		    // 获取 video 上下文 videoContext 对象
		    // this.videoContext = uni.createVideoContext('myVideo');
		    // 进入全屏状态
		    // this.videoContext.requestFullScreen();
		},
		onLoad(options) {
			console.log(options,'options')
			if(options.url){
				this.videoUrl=options.url
			}
			if(options.id){
				this.id = options.id
			}
			if(options.name){
				this.title= options.name
			}
			if(options.permission){
				this.permission=options.permission
			}
			uni.setNavigationBarTitle({
			　　title:this.title
			})
		},
		created(){
			this.getType()
		},
		methods: {
			lookedTime() {
				this.$u.get('/user/album/file/burned/duration').then(res => {
						if (res) {
							this.duration = res.data.duration
						}
					})
					.catch((res) => {})
			},
			getType(){
				// 销毁
				
				if(this.permission == '2' || this.permission == '4'){
				setTimeout(()=>{
					this.$u.post('/user/album/file/burned', {id:this.id}).then(res => {
							if (res) {
							console.log(res,'res')
							
							}
						})
						.catch((res) => {
							console.log(res.message)
						})
				},this.duration)
				}
				if(this.permission == '3' || this.permission == '4'){
					// 红包
					this.$u.get('/user/album/file/pay',{id:this.id}).then(res => {
							if (res.code == 200) {
								
							}else {
								
							}
						})
						.catch((res) => {
						})
					}
			}
		}
	}
</script>

<style>
	.video{
		width: 100%;
		height: 100%;
	}
	.video /deep/.uni-video-container {
		width: 100%;
		height: 100%;
	}
	.video .myVideo {
		width: 100%;
		height: 100%;
	}
</style>
